﻿using System;
using BSU.Math.Geometry;
using BSU.Math.Geometry;

namespace BSU.GraduateWork.LinesIn3D
{
    //public class Matrix3D
    //{

    //    private readonly double[,] _matrix = new double[3,3];

    //    public Matrix3D()
    //    {
    //        MakeIdentity();
    //    }

    //    public Matrix3D(double xRadians, double yRadians, double zRadians)
    //    {
    //        MakeIdentity();
    //        SetBy(NewRotate(xRadians, yRadians, zRadians));
    //    }

    //    public Matrix3D MakeIdentity()
    //    {
    //        _matrix[0, 0] = _matrix[1, 1] = _matrix[2, 2] = 1;
    //        _matrix[0, 1] = _matrix[0, 2] =
    //                             _matrix[1, 0] = _matrix[1, 2] =
    //                                                  _matrix[2, 0] = _matrix[2, 1] = 0;
    //        return this;
    //    }

    //    public void SetBy(Matrix3D matrix)
    //    {
    //        for (var i = 0; i < 3; i++)
    //        {
    //            for (var j = 0; j < 3; j++)
    //            {
    //                _matrix[i, j] = matrix._matrix[i, j];
    //            }
    //        }
    //    }

    //    public static Matrix3D NewRotateAroundX(double radians)
    //    {
    //        var matrix = new Matrix3D();
    //        matrix._matrix[1, 1] = System.Math.Cos(radians);
    //        matrix._matrix[1, 2] = System.Math.Sin(radians);
    //        matrix._matrix[2, 1] = -(System.Math.Sin(radians));
    //        matrix._matrix[2, 2] = System.Math.Cos(radians);
    //        return matrix;
    //    }
    //    public static Matrix3D NewRotateAroundY(double radians)
    //    {
    //        var matrix = new Matrix3D();
    //        matrix._matrix[0, 0] = System.Math.Cos(radians);
    //        matrix._matrix[0, 2] = -(System.Math.Sin(radians));
    //        matrix._matrix[2, 0] = System.Math.Sin(radians);
    //        matrix._matrix[2, 2] = System.Math.Cos(radians);
    //        return matrix;
    //    }
    //    public static Matrix3D NewRotateAroundZ(double radians)
    //    {
    //        var matrix = new Matrix3D();
    //        matrix._matrix[0, 0] = System.Math.Cos(radians);
    //        matrix._matrix[0, 1] = System.Math.Sin(radians);
    //        matrix._matrix[1, 0] = -(System.Math.Sin(radians));
    //        matrix._matrix[1, 1] = System.Math.Cos(radians);
    //        return matrix;
    //    }

    //    public static Matrix3D NewRotate(double radiansX, double radiansY, double radiansZ)
    //    {
    //        var matrix = NewRotateAroundX(radiansX);
    //        matrix = matrix * NewRotateAroundY(radiansY);
    //        matrix = matrix * NewRotateAroundZ(radiansZ);
    //        return matrix;
    //    }

    //    public static Matrix3D NewRotateByDegrees(double degreesX, double degreesY, double degreesZ)
    //    {
    //        return NewRotate(
    //            Angle.DegreesToRadians(degreesX), 
    //            Angle.DegreesToRadians(degreesY), 
    //            Angle.DegreesToRadians(degreesZ)
    //            );
    //    }

    //    public static Matrix3D NewRotateFromDegreesAroundX(double degrees)
    //    {
    //        return NewRotateAroundX(Angle.DegreesToRadians(degrees));
    //    }
    //    public static Matrix3D NewRotateFromDegreesAroundY(double degrees)
    //    {
    //        return NewRotateAroundY(Angle.DegreesToRadians(degrees));
    //    }
    //    public static Matrix3D NewRotateFromDegreesAroundZ(double degrees)
    //    {
    //        return new RotateAroundZMatrix(degrees, false);
    //        return NewRotateAroundZ(Angle.DegreesToRadians(degrees));
    //    }

    //    public static Matrix3D operator *(Matrix3D matrix1, Matrix3D matrix2)
    //    {
    //        var matrix = new Matrix3D();
    //        for(var i = 0; i < 3; i++)
    //        {
    //            for(var j = 0; j < 3; j++)
    //            {
    //                matrix._matrix[i, j] = 
    //                    (matrix2._matrix[i, 0] * matrix1._matrix[0, j]) +
    //                    (matrix2._matrix[i, 1] * matrix1._matrix[1, j]) +
    //                    (matrix2._matrix[i, 2] * matrix1._matrix[2, j]);
    //            }
    //        }
    //        return matrix;
    //    }

    //    public static Point3D operator *(Matrix3D matrix1, Point3D point3D)
    //    {
    //        var x = point3D.InitialX * matrix1._matrix[0, 0] +
    //                point3D.InitialY * matrix1._matrix[0, 1] +
    //                point3D.InitialZ * matrix1._matrix[0, 2];
    //        var y = point3D.InitialX * matrix1._matrix[1, 0] +
    //                point3D.InitialY * matrix1._matrix[1, 1] +
    //                point3D.InitialZ * matrix1._matrix[1, 2];
    //        var z = point3D.InitialX * matrix1._matrix[2, 0] +
    //                point3D.InitialY * matrix1._matrix[2, 1] +
    //                point3D.InitialZ * matrix1._matrix[2, 2];
    //        point3D.X = x;
    //        point3D.Y = y;
    //        point3D.Z = z;
    //        return point3D;
    //    }

    //}
}